package com.baylor.server.business.exception;

import com.baylor.server.business.common.ResponseObject;
import com.baylor.server.business.common.CustomException;
import com.baylor.server.business.constant.BusinessErrorEnum;

public class BusinessException extends CustomException {
    
    private static final long serialVersionUID = 1L;
    
    public BusinessException() {
        super();
    }

    public BusinessException(String errorMsg) {
        super(errorMsg);
    }

    public BusinessException(int errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
    }

    public BusinessException(int errorCode, String errorMsg, ResponseObject response) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.response = response;
    }

    public BusinessException(String errorMsg, Throwable cause) {
        super(errorMsg, cause);
    }

    public BusinessException(int errorCode, String errorMsg, Throwable cause) {
        super(errorMsg, cause);
        this.errorCode = errorCode;
    }

    public BusinessException(int errorCode, String errorMsg, ResponseObject response, Throwable cause) {
        super(errorMsg, cause);
        this.errorCode = errorCode;
        this.response = response;
    }

    public  static BusinessException getBusinessException(BusinessErrorEnum businessErrorEnum)
    {
       return new BusinessException(businessErrorEnum.getErrorCode(),businessErrorEnum.getErrorMsg());
    }


}
